﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminIndexMaster.master" AutoEventWireup="true" CodeFile="CM_Ad_Manage.aspx.cs" Inherits="Admin_CM_Ad_Manage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script src="Js/Function.js" type="text/javascript"></script> 
<script type="text/javascript" src="JS/mouse.js" ></script>
    <table class="nick">
        <tr>
            <td class="tit" style="width:6%;text-align:right;">
                广告名称：
            </td>
            <td class="tit" style="width:10%; text-align:left;">
                <asp:TextBox ID="txtAdName" MaxLength="100" Width="100px" runat="server"></asp:TextBox>
            </td>
            <td class="tit" style="width:6%;text-align:right;">
                省份：
            </td>
             <td class="tit" style="width:10%;text-align:left;">
             <asp:DropDownList ID="ddlProvince" Width="100px"  OnSelectedIndexChanged="ddlProvince_OnSelectedIndexChanged"
                            AutoPostBack="true" runat="server">
                </asp:DropDownList>
             </td>
            <td class="tit" style="width:6%;text-align:right;">
                城市：
            </td>
             <td class="tit" style="width:10%;text-align:left;">
             <asp:DropDownList ID="ddlSearchCity" Width="100px"  OnSelectedIndexChanged="ddlSearchCity_OnSelectedIndexChanged"
                            AutoPostBack="true" runat="server">
                </asp:DropDownList>
             </td>
            <td class="tit" style="width:6%;text-align:right;">
                 地区：
            </td>
             <td class="tit" style="width:10%;text-align:left;">
             <asp:DropDownList Width="100px"  ID="ddlSearchArea" runat="server">
                </asp:DropDownList>
             </td>
             <td class="tit" style="width:20%; text-align:center;"><asp:Button ID="btnSearch" runat="server" Text=" 查 询 " OnClick="btnSearch_Click" /></td>
              <td class="tit" style=" text-align:left;"><asp:Button ID="Button_Add" runat="server" Text=" 添 加 " OnClick="Button_Add_Click" /></td>
         </tr>
        
    </table>

            <asp:GridView ID="GridView1" runat="server"  AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand"  OnRowDataBound="GridView1_RowDataBound"  CssClass="adminlist">
          <Columns>
           <asp:TemplateField HeaderStyle-Width="1%">
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" Text=""  />
                    <asp:HiddenField ID="hfId" runat="Server" Value='<%#Eval("AdID") %>' />
                </ItemTemplate>
                <HeaderTemplate>
                   <input id="chkAll" onclick="SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                </HeaderTemplate>
            </asp:TemplateField>
             <asp:BoundField DataField="AdName"  HeaderText="广告名称" />
            <asp:BoundField DataField="AdLocation"  HeaderStyle-Width="7%" HeaderText="版位" />
            <asp:BoundField DataField="Province"  HeaderStyle-Width="8%" HeaderText="省份" />
            <asp:BoundField DataField="City"  HeaderStyle-Width="8%" HeaderText="城市" />
            <asp:BoundField DataField="Area"  HeaderStyle-Width="8%" HeaderText="地区" />
            <asp:TemplateField HeaderText="开始时间" HeaderStyle-Width="8%">
              <ItemTemplate>
              <%#Eval("BeginTime").ToString().Remove(Eval("BeginTime").ToString().IndexOf(" "))%>
              </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="结束时间" HeaderStyle-Width="8%">
              <ItemTemplate>
              <%#Eval("EndTime").ToString().Remove(Eval("EndTime").ToString().IndexOf(" "))%>
              </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="是否启用" HeaderStyle-Width="5%">
              <ItemTemplate>
              <%#Eval("Enabled").ToString()=="1"?"启用":"禁用"%>
              </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="ClickNum"  HeaderStyle-Width="5%" HeaderText="点击次数" />
            <asp:TemplateField HeaderText="图片预览" HeaderStyle-Width="8%">
              <ItemTemplate>
              <a title="<img src='<%#Eval("ImgPath")%>'/>" href="javascript:void(0)"> 图片</a>
              </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="操作" HeaderStyle-Width="10%">
              <ItemTemplate>
                <asp:HyperLink ID="f" runat="server" NavigateUrl='<%# "CM_Ad_Update.aspx?act=update&adid=" + Eval("AdID") %>' Text="修改"  />
                <asp:HiddenField ID="H_Img" runat="server" Value='<%# Eval("ImgPath") %>' />
                <asp:LinkButton ID="cl" runat="server" CommandName="del" Text="删除" CommandArgument='<%#Eval("AdID") %>' OnClientClick="{if(confirm('确定删除吗？')) return true;return false;}"  />
              </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
                    <tr>
                      <th>全选</th><th scope="col">广告名称</th><th scope="col">版位</th><th scope="col">省份</th><th scope="col">城市</th><th scope="col">地区</th><th scope="col">开始时间</th><th scope="col">结束时间</th><th scope="col">是否启用</th><th scope="col">点击次数</th><th scope="col">图片预览</th><th scope="col">操作</th>
		            </tr>
		            <tr>
		              <td colspan="12">暂无广告！</td>
		            </tr>
        </EmptyDataTemplate>
    </asp:GridView>
    <div runat="server" id="ThreeDiv" class="pagelist" style="width:100%;">
                <ul style="margin-left:auto; margin-right:auto;">
                    <asp:Literal ID="ltrPage" runat="server"></asp:Literal>
                </ul>
            </div>
      <div class="div_btm" style="background-color:White; margin-left:10px;margin-right:10px;">
         <asp:Button ID="Button1" runat="server" Text="启用" OnClick="Button1_Click" />
         <asp:Button ID="Button2" runat="server" Text="禁用" OnClick="Button2_Click" />&nbsp;
         <asp:Button ID="Button3" runat="server" OnClientClick="{if(confirm('确定删除吗？')) return true;return false;}" OnClick="Button3_Click" Text="批量删除" />
      </div>
  
</asp:Content>
